package com.bigger.arch.app.web;

import com.bigger.arch.app.biz.IDemoBiz;
import com.bigger.arch.app.biz.impl.Demo2BizImpl;
import com.bigger.arch.app.web.filter.BiggerAppFilter;
import com.bigger.arch.app.web.intercept.BiggerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;

import javax.annotation.PostConstruct;

@Configuration
public class BiggerAppConfig {
    @Bean("domo2Biz")
    public IDemoBiz demoBiz() {
        return new Demo2BizImpl();
    }

    @Bean
    public FilterRegistrationBean filterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new BiggerAppFilter());
        registration.addUrlPatterns("/*");
        registration.addInitParameter("paramName", "paramValue");
        registration.setName("BiggerAppFilter");
        registration.setOrder(1);
        return registration;
    }

    @Autowired
    private RequestMappingHandlerAdapter handlerAdapter;

    /*@PostConstruct
    public void initEditValidation(){
        //日期时间转换 StringToDateConverter
    }*/
}
